--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--[[

    读书

]]--
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---
    local OnReadFn = function(inst,book)
        inst.components.hutao_com_dialogue:Say("book_readed")
    end
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

return function(inst)
    inst:AddTag("reader")
    if not TheWorld.ismastersim then
        return
    end
    --------------------------------------------------------------------------------------------------------------------------
    --- 读书
        if inst.components.reader == nil then
            inst:AddComponent("reader")
        end    
        inst.components.reader:SetOnReadFn(OnReadFn)
    --------------------------------------------------------------------------------------------------------------------------
    --- 读书失败的 台词 替换。
        inst:ListenForEvent("hutao_master_postinit",function(inst)
            local old_Say = inst.components.talker.Say
            inst.components.talker.Say = function(self,str,...)
                if str == "only_used_by_waxwell_and_wicker" then
                    self.inst.components.hutao_com_dialogue:Say("book_readed")
                    return
                end
                return old_Say(self,str,...)
            end
        end)
    --------------------------------------------------------------------------------------------------------------------------

end